package com.lanyou.esb.cook.proxy.meta;

import java.rmi.NoSuchObjectException;

import org.apache.commons.lang3.StringUtils;

/**
 * 数据格式<br>
 * 描述:<br>
 * 1数据类型；2:json数据类型；3:json,xml组合类型
 * 
 * @author Davey.wu
 */
public enum DataFormate {
	XML("1"), JSON("2"), JSON_XML("3");
	public final String ValueCode;

	private DataFormate(String code) {
		this.ValueCode = code;
	}

	public static DataFormate get(String valueCode)
			throws NoSuchObjectException {
		if (StringUtils.isBlank(valueCode)) {
			throw new NullPointerException();
		}
		for (DataFormate type : DataFormate.values()) {
			if (type.ValueCode.equals(valueCode)) {
				return type;
			}
		}
		throw new NoSuchObjectException(valueCode);
	}
}
